package com.xuecheng.base.utils;

import com.alibaba.fastjson.JSON;
import java.util.function.Supplier;

public class JsonCopyUtil {
    public static <T> T parseOrThrow(String json, Class<T> clazz, Supplier<RuntimeException> exceptionSupplier) {
        try {
            return JSON.parseObject(json, clazz);
        } catch (Exception e) {
            System.out.println(e);
            throw exceptionSupplier.get();
        }
    }
}
